const colors = (index) => {
    switch(index%4){
        case 0:
            return {
                linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                stops: [
                    [0, 'rgba(18,255,254,1)'],
                    [0.5, 'rgba(18,255,254,0.6)'], // darken
                    [1, 'rgba(18,255,254,1)'] // darken
                ]
            };
            break;
        case 1:
            return {
                linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                stops: [
                    [0, 'rgba(254,237,87,1)'],
                    [0.5, 'rgba(254,237,87,0.6)'], // darken
                    [1, 'rgba(254,237,87,1)'] // darken
                ]
            };
            break;
        case 2:
            return {
                linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                stops: [
                    [0, 'rgba(67,164,255,1)'],
                    [0.5, 'rgba(67,164,255,0.6)'], // darken
                    [1, 'rgba(67,164,255,1)'] // darken
                ]
            };
            break;
        case 3:
            return {
                linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                stops: [
                    [0, 'rgba(6243,93,69,1)'],
                    [0.5, 'rgba(243,93,69,0.6)'], // darken
                    [1, 'rgba(243,93,69,1)'] // darken
                ]
            };
            break;
        case 4:
            return {
                linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
                stops: [
                    [0, 'rgba(204,204,204,1)'],
                    [0.5, 'rgba(204,204,204,0.6)'], // darken
                    [1, 'rgba(204,204,204,1)'] // darken
                ]
            };
            break;
        default:
            return 'rgba(0,0,0,0)'
            break;
    }
}
var chart = Highcharts.chart('container', {
    chart: {
        type: 'pie',
        options3d: {
            enabled: true,
            alpha: 65
        }
    },
    colors: ['#12fffe', '#feed57', '#43a4ff', '#f35d45', '#ccc'],
    title: {
        text: ''
    },
    subtitle: {
        text: ''
    },
    plotOptions: {
        pie: {
            // allowPointSelect: true,  // 可以被选择
            innerSize: '80%',
            depth: 45,
            slicedOffset: 20,
            dataLabels: {
                // 开启
                enabled: false,
            },
            shadow: ['red', 0,100,0.5, 100]
        },
        series: {
            borderWidth: 0,
            fillOpacity: 0.1,
            shadow: ['red', 0,100,0.5, 100]
            // colors: ['rgba(18 255 254, 0.4)', 'red', '#DDDF00', '#24CBE5', '#64E572', ],
        }
    },
    series: [{
        name: '货物金额',
        data: [
            {
                name: '222',
                y: 20,
                sliced: true,  // 默认突出
                selected: true,
                color: colors(0),
                shadow: true
            },
            {
                name: '23',
                y: 10,
                sliced: true,  // 默认突出
                selected: true,
                color: colors(1)
            },
            {
                name: 'adsf',
                y: 10,
                sliced: true,  // 默认突出
                selected: true,
                color: colors(2)
            },
            {
                name: 'asfasd',
                y: 5,
                sliced: true,  // 默认突出
                selected: true,
                color: colors(3)
            },
            {
                name: 'asfasd',
                y: 5,
                sliced: true,  // 默认突出
                selected: true,
                color: colors(0)
            },
            {
                name: 'asfasd',
                y: 5,
                sliced: true,  // 默认突出
                selected: true,
                color: colors(1)
            },
        ]
    }]
});
